<script>
export default {
  name: "goodsInfo",
  props: {
    goods: {
      type: Object,
      default: () => {
        return {};
      }
    }
  },
  data() {
    return {
    }
  },
  methods: {
    async init() {
      // const res = await defHttp.get({ url: '/erp/goods/queryByGtinOrName', params: { id: route.query.id } });
      // console.log(res);
      // this.baseInfo = res;
    }
  },
}
</script>

<template>
  <view class="goods">
    <view class="img"><image :src="`${goods.pictureFilename}`" style="width: 100%" mode="aspectFit"/></view>
    <view class="info">
      <view class="name">{{goods.goodsName || ''}}</view>
      <view class="kv">
        <view class="key">商品条码</view>
        <view class="value">{{goods.gtin || ''}}</view>
      </view>
      <view class="kv" v-if="goods.goodsName">
        <view class="key">品牌名称</view>
        <view class="value">{{goods.brandcn || ''}}</view>
      </view>
<!--      <view class="kv">-->
<!--        <view class="key">条码状态</view>-->
<!--        <view class="value">{{ goods.gtinStatus === '1' ? '该商品条码已在中国物品编码中心注册，编码信息已按规定通报。' : '&#45;&#45;' }}</view>-->
<!--      </view>-->
      <view class="kv" v-if="goods.goodsName">
        <view class="key">产品分类</view>
        <view class="value">{{ `${goods.gpcNam || ''}${goods.gpc || ''}` }}</view>
      </view>
      <view class="kv" v-if="goods.goodsName">
        <view class="key">上市日期</view>
        <view class="value">{{goods.saleDate || ''}}</view>
      </view>
      <view class="kv" v-if="goods.goodsName">
        <view class="key">净含量</view>
        <view class="value">{{goods.specification || ''}}</view>
      </view>
    </view>
  </view>
</template>

<style scoped lang="scss">
.goods{
  background: #fff;
}
.img{
  font-size: 0;
  width: 100%;
  min-height: 400rpx;
  background: #fff;
  margin: auto;
}
.info{
  padding: 20rpx 40rpx;
  .name{
    font-size: 36rpx;
    margin-top: 50rpx;
    margin-bottom: 30rpx;
    font-weight: bold;
  }
  .kv{
    display: flex;
    justify-content: space-between;
    margin-top: 20rpx;
    .key{
      color: #666;
    }
  }
}
</style>
